package com.apexsoft.test.sample.ams.producer;

import com.apexsoft.aas.service.annotations.ABusiness;
import com.apexsoft.aas.service.annotations.AService;
import com.apexsoft.aas.service.model.ARequest;
import com.apexsoft.aas.service.model.AResponse;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: initializr
 * @Description:
 * @Date: Created in 2019-10-23 13:43
 * @MODIFIED BY:
 */
@ABusiness(namespace = "test",pkg = "abc")
public class ABusinessProducerDemo {

    @AService(name="service1")
    public AResponse service1(ARequest req){

        Map<String,Object> params = req.getParams();
        String name = "ABusinessService";
        if(params.containsKey("name")){
            name = params.get("name").toString();
        }
        AResponse resp = new AResponse();
        resp.setCode(2);
        resp.setNote("success");

        Map<String,Object> data = new HashMap<>();
        data.put("name","hello:"+name);
        resp.setData(data);

        return resp;
    }


}
